#include<stdio.h>
#include<math.h>
int main()
{
    unsigned long long int m,n,i,x1=1,x2=1,y;
    unsigned long long int p=1e9+7;
    scanf("%llu%llu",&m,&n);
    for(i=1;i<=(n/2);i++)
    {
        x1=x1*(m%p);
    }
    for(i=1;i<=n-(n/2);i++)
    {
        x2=x2*(m%p);
    }
    y=(x1%p*x2%p)%p;
    printf("%llu",y%p);
    return 0;
}
/*#include<stdio.h>
#include<math.h>
int main()
{
    unsigned long long int m,n,i,x=1;
    unsigned long long int p=1e9+7;
    scanf("%llu%llu",&m,&n);
    for(i=0;i<n;i++)
    {
        x=m*x;
    }
    printf("%llu",x%p);
    return 0;
}*/